package com.sigmatrix.h5.properties;

import java.util.Map;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Component;

import com.sigmatrix.h5.utils.CommonUtils;
/**
 * 
 *@ClassName: AutoAuditProperties
 *@Description:自动审核开关
 *@author MH
 *@date 2018年1月25日 上午9:08:01
 */
@Component
@ConfigurationProperties("auto.audit")
@EnableConfigurationProperties
public class AutoAuditProperties {
	
	private Map<String,Map<Module,Boolean>> swither;
	
	/**
	 * 
	 *@Title: auto
	 *@Description:判断是否是自动审核
	 *@return boolean
	 *@author MH
	 *@date 2018年1月25日 上午9:55:42
	 *@param eseCode
	 *@param module
	 *@return
	 */
	public boolean auto(String eseCode,Module module){
		Map<Module, Boolean> map = swither.get(eseCode);
		if(CommonUtils.isEmpty(map))return false;
		return map.get(module);
	}
	
	public Map<String, Map<Module, Boolean>> getSwither() {
		return swither;
	}

	public void setSwither(Map<String, Map<Module, Boolean>> swither) {
		this.swither = swither;
	}
	
	public enum Module{
		
		rebate,
		
		shop,
		
		dealer
		
	}
}
